package com.project.bean;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;

public class UserBean {
    private Integer id;
    @NotBlank(message = "姓名必须填写")
    @Pattern(regexp = "[a-zA-Z]\\u4e00-\\u9fa5{2,}", message = "姓名为两个以上的字母或汉字")
    private String name;
    private String sex;
//    @NotBlank(message = "工资必须填写")
    @Max(value = 1000000, message = "工资不能高于10万")
    @Min(value = 1800, message = "工资不能低于100")
//    @Pattern(regexp = "[1-9][0-9]{0,5}", message = "请填写数字")
    private Integer money;
//    @NotBlank(message = "生日必须填填写")
    private LocalDate birthday;

    public UserBean() {
    }

    public UserBean(String name, String sex, Integer money, LocalDate birthday) {
        this.name = name;
        this.sex = sex;
        this.money = money;
        this.birthday = birthday;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    public LocalDate getBirthday() {
        return birthday;
    }

    public void setBirthday(LocalDate birthday) {
        this.birthday = birthday;
    }


    @Override
    public String toString() {
        return "UserBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", money=" + money +
                ", birthday=" + birthday +
                '}' + "\n";
    }
}
